<include file="Common:header" />
<body>
<script src="<{:__PUBLIC__}>/js/LodopFuncs.js"></script>
<object id="LODOP_OB" classid="clsid:2105C259-1E0C-4534-8141-A753534CB4CA" width=0 height=0> 
	<embed id="LODOP_EM" type="application/x-print-lodop" width=0 height=0 pluginspage="install_lodop32.exe"></embed>
</object>

<div id="PrintArea" class="PrintArea">

</div>

<script language="javascript" type="text/javascript">   
    var LODOP; //声明为全局变量 
	function Print5() {
    	try {
    	$('#btnPrintAll').attr('disabled', 'disabled');
    		
    	
		LODOP=getLodop(document.getElementById('LODOP_OB'),document.getElementById('LODOP_EM'));
		
		if (document.getElementById("Radio2").checked) {
			LODOP.SET_PRINTER_INDEXA(getSelectedPrintIndex());
		}
		
		<{$printjs}>
		<{$printtimejs}>
		setTimeout( function(){ 
			$('#btnPrintAll').removeAttr('disabled');
			
		}, 5000 );
    	} catch( e ){
    		
    		alert( e.message );
    	}
	};
	
	function Preview5() {
		LODOP=getLodop(document.getElementById('LODOP_OB'),document.getElementById('LODOP_EM'));
		if (document.getElementById("Radio2").checked) {
			LODOP.SET_PRINTER_INDEX(getSelectedPrintIndex());
			
		}
		<{$printjs_view}>
		LODOP.PREVIEW();
		
		
	}
	
	function prn1_printA() {		
		LODOP=getLodop(document.getElementById('LODOP_OB'),document.getElementById('LODOP_EM'));
		//<{$printjs_view}>
		
		LODOP.PRINTA(); 	
	};

	
	function CreatePrinterList(){
	   
		LODOP=getLodop(document.getElementById('LODOP_OB'),document.getElementById('LODOP_EM')); 
		var iPrinterCount=LODOP.GET_PRINTER_COUNT();
		for(var i=0;i<iPrinterCount;i++){

   			var option=document.createElement('option');
   			option.innerHTML=LODOP.GET_PRINTER_NAME(i);
   			option.value=i;
			document.getElementById('PrinterList').appendChild(option);
		};	
	};
	
	function getSelectedPrintIndex(){
		if (document.getElementById("Radio2").checked) 
		return document.getElementById("PrinterList").value;
		else return -1; 		
	};
	
	
</script>


<p> 选择如下打印机：<input type="radio" checked="" name="RadioS1" id="Radio1">默认打印机                         
  <input type="radio" onclick="CreatePrinterList()" name="RadioS1" id="Radio2">指定打印机:                  
<select size="1" id="PrinterList"></select> </p>



<p style="margin-top:">


  <input type="button" id="btnPrintAll" value="直接打印" onclick="javascript:Print5();"> - <a href="javascript:Preview5()">打印预览</a> -  <br>


<br>

</p>

</body>
</html>